import 'package:equatable/equatable.dart';

/// 用户实体类
class User extends Equatable {
  final int id;
  final String username;
  final String email;
  final String role;
  final String? orgName;
  final String? avatarUrl;

  const User({
    required this.id,
    required this.username,
    required this.email,
    required this.role,
    this.orgName,
    this.avatarUrl,
  });

  @override
  List<Object?> get props => [id, username, email, role, orgName, avatarUrl];

  User copyWith({
    int? id,
    String? username,
    String? email,
    String? role,
    String? orgName,
    String? avatarUrl,
  }) {
    return User(
      id: id ?? this.id,
      username: username ?? this.username,
      email: email ?? this.email,
      role: role ?? this.role,
      orgName: orgName ?? this.orgName,
      avatarUrl: avatarUrl ?? this.avatarUrl,
    );
  }
}
